package o;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.io.IOException;
import java.io.InputStream;
import java.util.Queue;

public class aao extends InputStream {
    private static final Queue<aao> ˊ = aau.ॱ(0);
    private InputStream ˋ;
    private IOException ˎ;

    @NonNull
    public static aao ˊ(@NonNull InputStream inputStream) {
        aao o_aao;
        synchronized (ˊ) {
            o_aao = (aao) ˊ.poll();
        }
        if (o_aao == null) {
            o_aao = new aao();
        }
        o_aao.ˏ(inputStream);
        return o_aao;
    }

    aao() {
    }

    void ˏ(@NonNull InputStream inputStream) {
        this.ˋ = inputStream;
    }

    public int available() throws IOException {
        return this.ˋ.available();
    }

    public void close() throws IOException {
        this.ˋ.close();
    }

    public void mark(int i) {
        this.ˋ.mark(i);
    }

    public boolean markSupported() {
        return this.ˋ.markSupported();
    }

    public int read(byte[] bArr) {
        try {
            return this.ˋ.read(bArr);
        } catch (IOException e) {
            this.ˎ = e;
            return -1;
        }
    }

    public int read(byte[] bArr, int i, int i2) {
        try {
            return this.ˋ.read(bArr, i, i2);
        } catch (IOException e) {
            this.ˎ = e;
            return -1;
        }
    }

    public synchronized void reset() throws IOException {
        this.ˋ.reset();
    }

    public long skip(long j) {
        try {
            return this.ˋ.skip(j);
        } catch (IOException e) {
            this.ˎ = e;
            return 0;
        }
    }

    public int read() {
        try {
            return this.ˋ.read();
        } catch (IOException e) {
            this.ˎ = e;
            return -1;
        }
    }

    @Nullable
    public IOException ˊ() {
        return this.ˎ;
    }

    public void ˎ() {
        this.ˎ = null;
        this.ˋ = null;
        synchronized (ˊ) {
            ˊ.offer(this);
        }
    }
}
